<!DOCTYPE html>
<html lang="en">
<style>
    ul.group-list li {
        white-space: nowrap;float: left;
        width: 150px; height: 25px;
        padding: 3px 5px;list-style-type: none;
        list-style-position: outside;border: 0px;margin: 0px;
    }
    input[type=checkbox], input[type=radio] {
        display: inline-block;
    }
</style>
<link href="/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
{include file="Public/head"}

<body data-type="widgets">
<!--<script src="/daterangepicker/jquery-3.2.1.min.js" type="text/javascript"></script>-->
<script src="/assets/js/theme.js"></script>
<div class="am-g tpl-g">

    {include file='Public:header'}
    {include file='Public:menu2'}



    <!-- 内容区域 -->
    <div class="tpl-content-wrapper" >
        <div class="row-content am-cf">
            <div class="row">

                <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                    <div class="widget am-cf">
                        <div class="widget-head am-cf">
                            <div class="widget-title am-fl">编辑自提点</div>
                            <div class="widget-function am-fr">
                                <a href="javascript:;" class="am-icon-cog"></a>
                            </div>
                        </div>
                        <div class="widget-body am-fr">
                            <form id="roleform"  form="submit" class="am-form tpl-form-border-form tpl-form-border-br">
                                <div class="am-form-group">
                                    <label for="user-name" class="col-sm-2 control-label">自提点名称 </label>
                                    <div class="am-u-sm-9">
                                        <input type="text" class="tpl-form-input" name="pickup_name" id="pickup_name" placeholder="名称" value="{$data.pickup_name}">
                                        <small></small>
                                    </div>
                                </div>

                                <div class="am-form-group">
                                    <label for="user-name" class="col-sm-2 control-label">自提点地址 </label>
                                    <div class="am-u-sm-9">
                                        <div data-toggle="distpicker" id="target">
                                            <select class="form-control m-b" name="province" id="province" data-province="{$data.province}"></select>

                                            <select class="form-control m-b" name="city" id="city" data-city="{$data.city}"></select>

                                            <select class="form-control m-b" name="district" id="district" data-district="{$data.district}"></select>
                                        </div>
                                    </div>
                                </div>

                                <div class="am-form-group">
                                    <label for="user-name" class="col-sm-2 control-label">供货商</label>
                                    <div class="col-sm-2">
                                        <select class="form-control input-sm" name="suppliersid" id="suppliersid">
                                            <option value="0">不选择则无供货商</option>
                                            {foreach name="list" key="key" item="v"}
                                            <option value="{$v.suppliers_id}" {if $data.suppliersid eq $v.suppliers_id}selected="selected"{/if}>{$v.suppliers_name}</option>
                                            {/foreach}
                                        </select>
                                    </div>
                                 </div>

                                <div class="am-form-group">
                                    <label for="user-name" class="col-sm-2 control-label">详细地址</label>
                                    <div class="am-u-sm-9">
                                        <textarea class="he110 wi80-BFB re-no" name="pickup_address" id="pickup_address" placeholder="详细地址" maxlength="100">{$data.pickup_address}</textarea>
                                        <small></small>
                                    </div>
                                </div>

                                <div class="am-form-group">
                                    <label for="user-name" class="col-sm-2 control-label">自提点联系人</label>
                                    <div class="am-u-sm-9">
                                        <input type="text" class="tpl-form-input" name="pickup_contact" id="pickup_contact" placeholder="联系人" value="{$data.pickup_contact}">
                                        <small></small>
                                    </div>
                                </div>

                                <div class="am-form-group">
                                    <label for="user-name" class="col-sm-2 control-label">自提点电话</label>
                                    <div class="am-u-sm-9">
                                        <input type="text" class="tpl-form-input" name="pickup_phone" id="pickup_phone" placeholder="电话"  value="{$data.pickup_phone}">
                                        <small></small>
                                    </div>
                                </div>

                                <div class="am-form-group">
                                    <div class="am-u-sm-9 am-u-sm-push-3">
                                        <a onclick="javascript:history.back(-1);" ><div class="btn btn-default" type="reset" >返回</div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
                                        <button class="btn btn-info" type="button" onclick="master_add()">提交</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</div>

</body>

<script src="/static/Distpicker/js/distpicker.data.js"></script>
<script src="/static/Distpicker/js/distpicker.js"></script>
<script src="/static/Distpicker/js/main.js"></script>
{include file='Public:script'}
{include file='Public:validation'}
<script>
    $('#target').distpicker({
        autoSelect: false
    });
    //提交
    function master_add(){
        var param = new Object();
        $("input").each(function(k, v){
            v = $(v);
            param[v.attr("id")] = v.val();
        });
        param['pickup_id']={$data.pickup_id};
        param['pickup_address']=$("#pickup_address").val();
        param['suppliersid']= $("#suppliersid option:selected").val();
        param['province']= $("#province option:selected").val();
        param['city']= $("#city option:selected").val();
        param['district']= $("#district option:selected").val();
        $.post(
            "{:url('edit')}",
             param,
             function(ret){
            if(ret.code != 200){
                layer.msg(ret.msg, {icon: 2});
                return false;
            }
            layer.msg(ret.msg, {icon: 1,time:2000},function(){
                location.href = "{:url('pickup_list')}";
            });
        });
    }
</script>

</html>